package com.opgea.crm.services;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;



import com.opgea.crm.common.constant.ApplicationConstant;
import com.opgea.crm.domain.entities.SetupsValue;
import com.opgea.crm.domain.modal.QualifierModel;

@Service
public class QualifierService {

	@Autowired
	SetupService setupService;
	
   public SetupsValue findById(long attrValueid)
	
	{
		return setupService.findById(attrValueid);
	}

	public List<QualifierModel> getSearchPeriodQualifiers(){
		List<QualifierModel> searchPeriodQualifiers = new ArrayList<QualifierModel>();
		for (ApplicationConstant.PeriodQualifier qual : ApplicationConstant.PeriodQualifier.values()) {
			searchPeriodQualifiers.add(new QualifierModel(Long.valueOf(qual.ordinal()), qual.name()));
		}
		return searchPeriodQualifiers;
	}   
   
	public List<QualifierModel> getAddressQualifiers(){
		List<QualifierModel> addressQualifiers = new ArrayList<QualifierModel>();
		for (ApplicationConstant.AddressQualifier qual : ApplicationConstant.AddressQualifier.values()) {
			addressQualifiers.add(new QualifierModel(Long.valueOf(qual.ordinal()), qual.name()));
		}
		return addressQualifiers;
	}
	
	public List<QualifierModel> getPhoneQualifiers(){
		List<QualifierModel> phoneQualifiers = new ArrayList<QualifierModel>();
		for (ApplicationConstant.PhoneQualifier qual : ApplicationConstant.PhoneQualifier.values()) {
			phoneQualifiers.add(new QualifierModel(Long.valueOf(qual.ordinal()), qual.name()));
		}
		return phoneQualifiers;
	}
	
	public List<QualifierModel> getEmailQualifiers(){
		List<QualifierModel> emailQualifiers = new ArrayList<QualifierModel>();
		for (ApplicationConstant.EmailQualifier qual : ApplicationConstant.EmailQualifier.values()) {
			emailQualifiers.add(new QualifierModel(Long.valueOf(qual.ordinal()), qual.name()));
		}
		return emailQualifiers;
	}
	
	public List<QualifierModel> getPrefixQualifiers(){
		List<QualifierModel> prefixQualifiers = new ArrayList<QualifierModel>();
		for (ApplicationConstant.PrefixQualifier qual : ApplicationConstant.PrefixQualifier.values()) {
			prefixQualifiers.add(new QualifierModel(Long.valueOf(qual.ordinal()), qual.name()));
		}
		return prefixQualifiers;
	}
	
	public List<QualifierModel> getSuffixQualifiers(){
		List<QualifierModel> suffixQualifiers = new ArrayList<QualifierModel>();
		for (ApplicationConstant.SuffixQualifier qual : ApplicationConstant.SuffixQualifier.values()) {
			suffixQualifiers.add(new QualifierModel(Long.valueOf(qual.ordinal()), qual.name()));
		}
		return suffixQualifiers;
	}
	
	public List<QualifierModel> getTitleQualifiers(){
		List<QualifierModel> titleQualifiers = new ArrayList<QualifierModel>();
		for (ApplicationConstant.TitleQualifier qual : ApplicationConstant.TitleQualifier.values()) {
			titleQualifiers.add(new QualifierModel(Long.valueOf(qual.ordinal()), qual.name()));
		}
		return titleQualifiers;
	}
	
	public List<QualifierModel> getCategoryQualifiers(){
		List<QualifierModel> categoryQualifiers = new ArrayList<QualifierModel>();
		for(ApplicationConstant.CategoryQualifier qualifier : ApplicationConstant.CategoryQualifier.values()){
			categoryQualifiers.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return categoryQualifiers;
	}
	
	
	public List<QualifierModel> getDocumentQualifier(){
		List<QualifierModel> docQualifiers = new ArrayList<QualifierModel>();
		for(ApplicationConstant.DocumentQualifier qualifier : ApplicationConstant.DocumentQualifier.values()){
			docQualifiers.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return docQualifiers;
	}
	
	public List<QualifierModel> getIndustryTypes(){
		List<QualifierModel> industries = new ArrayList<QualifierModel>();
		for(ApplicationConstant.IndustryQualifier qualifier : ApplicationConstant.IndustryQualifier.values()){
			industries.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return industries;
	}
	
	public List<QualifierModel> getLeadStatusTypes(){
		List<QualifierModel> leadStatusTypes = new ArrayList<QualifierModel>();
		for(ApplicationConstant.LeadStatusQualifier qualifier : ApplicationConstant.LeadStatusQualifier.values()){
			leadStatusTypes.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return leadStatusTypes;
	}
	
	public List<QualifierModel> getSourceTypes(){
		List<QualifierModel> sources = new ArrayList<QualifierModel>();
		for(ApplicationConstant.SourceQualifier qualifier : ApplicationConstant.SourceQualifier.values()){
			sources.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return sources;
	}
	
	public List<QualifierModel> getCategoryTypes(){
		List<QualifierModel> categories = new ArrayList<QualifierModel>();
		for(ApplicationConstant.CategoryQualifier qualifier : ApplicationConstant.CategoryQualifier.values()){
			categories.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return categories;
	}
	
	public List<QualifierModel> getGradeTypes(){
		List<QualifierModel> grades = new ArrayList<QualifierModel>();
		for(ApplicationConstant.GradeQualifier qualifier : ApplicationConstant.GradeQualifier.values()){
			grades.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return grades;
	}	
	/*
	public List<QualifierModel> getQualifiers(SetupsModuleQualifier moduleQualifier,SetupsAttributeQualifier sAttributeQualifier){
		return setupService.listSetupValue(moduleQualifier.ordinal(),sAttributeQualifier.ordinal());
	}*/

	
	public List<QualifierModel> getStatusTypes(){
		List<QualifierModel> status = new ArrayList<QualifierModel>();
		for(ApplicationConstant.StatusQualifier qualifier : ApplicationConstant.StatusQualifier.values()){
			status.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return status;
	}
	
	public List<QualifierModel> getStageTypes(){
		List<QualifierModel> stages = new ArrayList<QualifierModel>();
		for(ApplicationConstant.StageQualifier qualifier : ApplicationConstant.StageQualifier.values()){
			stages.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return stages;
	}	
	
	public List<QualifierModel> getPriorityTypes(){
		List<QualifierModel> stages = new ArrayList<QualifierModel>();
		for(ApplicationConstant.PriorityQualifier qualifier : ApplicationConstant.PriorityQualifier.values()){
			stages.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return stages;
	}	
	
	public List<QualifierModel> getActionTypes(){
		List<QualifierModel> actions = new ArrayList<QualifierModel>();
		for(ApplicationConstant.ActionQualifier qualifier : ApplicationConstant.ActionQualifier.values()){
			actions.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return actions;
	}
	
	public List<QualifierModel> getClosingProbabilityTypes(){
		List<QualifierModel> probabilities = new ArrayList<QualifierModel>();
		for(ApplicationConstant.ClosingProbabilityQualifier qualifier : ApplicationConstant.ClosingProbabilityQualifier.values()){
			probabilities.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return probabilities;
	}	
	
	public List<QualifierModel> getLeadSearchCriteriaTypes(){
		List<QualifierModel> leadSearchTypes = new ArrayList<QualifierModel>();
		for(ApplicationConstant.LeadSearchCriteriaQualifier qualifier : ApplicationConstant.LeadSearchCriteriaQualifier.values()){
			leadSearchTypes.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
			System.out.println("Lead Search Type : "+qualifier);
		}
		return leadSearchTypes;
	}	
	
	public List<QualifierModel> getActivitySearchCriteriaTypes(){
		List<QualifierModel> activitySearchTypes = new ArrayList<QualifierModel>();
		for(ApplicationConstant.ActivitySearchCriteriaQualifier qualifier : ApplicationConstant.ActivitySearchCriteriaQualifier.values()){
			activitySearchTypes.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
			System.out.println("Activity Search Type : "+qualifier);
		}
		return activitySearchTypes;
	}		
	
	public List<QualifierModel> getOpportunitySearchCriteriaTypes(){
		List<QualifierModel> opportunitySearchTypes = new ArrayList<QualifierModel>();
		for(ApplicationConstant.OpportunitySearchCriteriaQualifier qualifier : ApplicationConstant.OpportunitySearchCriteriaQualifier.values()){
			opportunitySearchTypes.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return opportunitySearchTypes;
	}	
	
	public List<QualifierModel> getDocumentTypes(){
		List<QualifierModel> documentTypes = new ArrayList<QualifierModel>();
		for(ApplicationConstant.DocumentQualifier qualifier : ApplicationConstant.DocumentQualifier.values()){
			documentTypes.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return documentTypes;
	}	
	
	public List<QualifierModel> getEmployeeTypes(){
		List<QualifierModel> employeeTypes = new ArrayList<QualifierModel>();
		for(ApplicationConstant.EmployeeQualifier qualifier : ApplicationConstant.EmployeeQualifier.values()){
			employeeTypes.add(new QualifierModel(Long.valueOf(qualifier.ordinal()), qualifier.name()));
		}
		return employeeTypes;
	}		
	
	public List<QualifierModel> getDummyOwners(){
		List<QualifierModel> owners = new ArrayList<QualifierModel>();
		owners.add(new QualifierModel(Long.valueOf(1), "Shekhar"));
		owners.add(new QualifierModel(Long.valueOf(2), "Mritunjay"));
		owners.add(new QualifierModel(Long.valueOf(3), "Rachna"));
		return owners;
	}
	
	public List<QualifierModel> getDummyCountries(){
		List<QualifierModel> countries = new ArrayList<QualifierModel>();
		countries.add(new QualifierModel(Long.valueOf(1), "India"));
		countries.add(new QualifierModel(Long.valueOf(2), "Japan"));
		countries.add(new QualifierModel(Long.valueOf(3), "South Africa"));
		countries.add(new QualifierModel(Long.valueOf(4), "USA"));
		return countries;
	}
	
	public List<QualifierModel> getDummyProvinces(){
		List<QualifierModel> cities = new ArrayList<QualifierModel>();
		cities.add(new QualifierModel(Long.valueOf(1), "Noida"));
		cities.add(new QualifierModel(Long.valueOf(2), "Durban"));
		cities.add(new QualifierModel(Long.valueOf(3), "California"));
		cities.add(new QualifierModel(Long.valueOf(4), "Tokyo"));
		return cities;
	}	
}
